package com.zengjianjun.storm.demo.util;

import lombok.Data;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * @author zengjianjun
 */

@Data
public class SpringContext implements ApplicationContextAware {

    private static ApplicationContext applicationContext = null;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        synchronized (this) {
            if (SpringContext.applicationContext == null) {
                SpringContext.applicationContext = applicationContext;
            }
        }
    }
}
